package com.summer.user.center.controller;

import com.summer.user.center.model.TestTable;
import com.summer.user.center.service.TestTableService;
import io.seata.spring.annotation.GlobalTransactional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/userCenter")
public class TestController {

    @Autowired
    private TestTableService testTableService;

    @GetMapping("/test")
    @GlobalTransactional
    public String test(){
        for (int i = 0; i < 10; i++) {
            TestTable testTable=new TestTable();
            testTable.setColumnOne(i+"");
            testTable.setColumnTwo(i);
            testTableService.insert(testTable);
        }


        return "userCenter";
    }

}
